"""
@param:
w : write pattern
    1.if the file doesn't exist, create the file
    2.if the file exits, open and clear all contents in the file
    3.after opening the file, pointer point the first position
r : read pattern
    1.if the file doesn't exist, output the exception
    2.if the file exits, open the file
    3.after opening the file, pointer point the first position
x : xor pattern
    1.if the file doesn't exist, create the file
    2.if the file exits, output the exception(avoiding the override)
    3.after opening the file, pointer point the first position
a : append pattern
    1.if the file doesn't exist, create the file
    2.if the file exits, open but don't clear all contents in the file
    3.after opening the file, pointer point the last position
b : bytes pattern
+ : plus pattern
Combination of operation pattern
w,r,a,x
wb,rb,ab,xb
w+,r+,a+,x+
wb+,rb+,ab+,xb+
"""
# w pattern
fp = open("../Enclosure/test_02.txt", "w", encoding="utf-8")
fp.write("This is just a file for testing!")
fp.close()
# r pattern
fp = open("../Enclosure/test_01.txt", "r", encoding="utf-8")
res_01 = fp.read()
print(res_01, type(res_01))
fp.close()
# # x pattern
# fp = open("../Enclosure/test_04.txt", "x+", encoding="utf-8")
# fp.write("This is just a file for testing!")
# fp.close()
# a pattern
fp = open("../Enclosure/test_02.txt", "a", encoding="utf-8")
fp.write("\n")
fp.write("This is just a file for testing!")
fp.close()